@page "/today"
@using Microsoft.JSInterop
@inject ITodayImageService _todayImageService
@inject ITodayPoetryService _todayPoetryService
@inject INavigationService _navigationService
@inject IJSRuntime _jsRuntime

<div style="background-image: linear-gradient(180deg, rgb(5, 39, 103) 0%, #3a0647 70%); padding: 1.5em; color: white">
    @if (_isLoading) {
        <h1><Spinner></Spinner></h1>
    } else {
        <h1>@_todayPoetry.Snippet</h1>
        <div class="shim-xl"/>
        <h3>@_todayPoetry.Dynasty @_todayPoetry.Author</h3>
        <h3>@_todayPoetry.Name</h3>

        <div style="display: @(_todayPoetry.Source == TodayPoetrySources.Jinrishici ? "block" : "hidden")">
            <div class="shim-xl"/>
            推荐自
            <a href="https://www.jinrishici.com/"
               target="_blank">
                今日诗词
            </a>
        </div>

        <div class="shim-xl"/>
        <Button OnClick="() => { _isShowDetail = true; StateHasChanged(); }">查看全文</Button>

        @if (_isShowDetail) {
            <div class="shim-2xl"></div>
            <h3>@(new MarkupString(_todayPoetry.Content.Replace(Environment.NewLine, "<br />")))</h3>
        }
    }
</div>
<img id="image"
     class="w-100"/>
<div class="shim-xs"></div>
<p>
    <a href="@_todayImage.CopyrightLink"
       target="_blank">
        @_todayImage.Copyright
    </a>
</p>
<p>
    Daily Poetry Hybird
    <a href="https://gitee.com/zhangyin-gitee/daily-poetry-h"
       target="_blank">
        https://gitee.com/zhangyin-gitee/daily-poetry-h
    </a>
</p>